package com.sellerSystem.vo;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

@Entity
@Table(name = "seller")
public class Seller implements Serializable {

	/*
	 * 包括卖家的姓名、手机、密码、邮箱、其他联系方式（例如qq）、 商家类型、门店名称、城市集合、 详细地址、门店电话、当前状态。
	 */

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	// 卖家ID
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer sellerId;

	// 卖家姓名
	@Column(nullable = false)
	private String sellerName;

	// 卖家账户密码
	@Column(nullable = false)
	private String sellerPsd;

	// 卖家电话
	@Column(nullable = false, unique = true)
	private String sellerTel;

	// 卖家邮箱
	@Column(nullable = false)
	private String sellerEmail;

	// 卖家QQ

	private String sellerQQ;

	// 商家类型
	@Column(nullable = false)
	private String shoppingStyle;

	// 店面名称
	@Column(nullable = false)
	private String shoppingName;

	@Embedded
	@AttributeOverrides({
			@AttributeOverride(name = "province", column = @Column(name = "province",nullable = false)),
			@AttributeOverride(name = "city", column = @Column(name = "city",nullable = false)),
			@AttributeOverride(name = "town", column = @Column(name = "town",nullable = false)),
			@AttributeOverride(name = "detailAddress", column = @Column(name = "detailAddress",nullable = false)) })
	private SellerAddress sellerAddress;

	// 店面电话
	@Column(nullable = false, unique = true)
	private String shoppingTel;

	// 卖家状态(有 0：待审批、1:审批通过、2:审批未通过、、3：被加入黑名单 4种情况)
	private int sellerState;

	// 一个卖家对应多条投诉信息
	@OneToMany(mappedBy = "seller", cascade = CascadeType.PERSIST)
	@Transient
	private Set<ComplaintInfo> complaintInfo = new HashSet<ComplaintInfo>();

	// 备注（如加入黑名单，此项需添加原因）
	private String sellerRemark;
	// 审批意见
	private String approvalOpinion;
	// 被投诉次数
	private int complaintNum;

	public Integer getSellerId() {
		return sellerId;
	}

	public void setSellerId(Integer sellerId) {
		this.sellerId = sellerId;
	}

	public String getSellerName() {
		return sellerName;
	}

	public void setSellerName(String sellerName) {
		this.sellerName = sellerName;
	}

	public String getSellerPsd() {
		return sellerPsd;
	}

	public void setSellerPsd(String sellerPsd) {
		this.sellerPsd = sellerPsd;
	}

	public String getSellerEmail() {
		return sellerEmail;
	}

	public void setSellerEmail(String sellerEmail) {
		this.sellerEmail = sellerEmail;
	}

	public String getSellerTel() {
		return sellerTel;
	}

	public void setSellerTel(String sellerTel) {
		this.sellerTel = sellerTel;
	}

	public String getSellerQQ() {
		return sellerQQ;
	}

	public void setSellerQQ(String sellerQQ) {
		this.sellerQQ = sellerQQ;
	}

	public String getShoppingStyle() {
		return shoppingStyle;
	}

	public void setShoppingStyle(String shoppingStyle) {
		this.shoppingStyle = shoppingStyle;
	}

	public String getShoppingName() {
		return shoppingName;
	}

	public void setShoppingName(String shoppingName) {
		this.shoppingName = shoppingName;
	}

	public SellerAddress getSellerAddress() {
		return sellerAddress;
	}

	public void setSellerAddress(SellerAddress sellerAddress) {
		this.sellerAddress = sellerAddress;
	}

	public int getSellerState() {
		return sellerState;
	}

	public void setSellerState(int sellerState) {
		this.sellerState = sellerState;
	}

	public String getShoppingTel() {
		return shoppingTel;
	}

	public void setShoppingTel(String shoppingTel) {
		this.shoppingTel = shoppingTel;
	}

	public Set<ComplaintInfo> getComplaintInfo() {
		return complaintInfo;
	}

	public void setComplaintInfo(Set<ComplaintInfo> complaintInfo) {
		this.complaintInfo = complaintInfo;
	}

	public String getSellerRemark() {
		return sellerRemark;
	}

	public void setSellerRemark(String sellerRemark) {
		this.sellerRemark = sellerRemark;
	}

	public String getApprovalOpinion() {
		return approvalOpinion;
	}

	public void setApprovalOpinion(String approvalOpinion) {
		this.approvalOpinion = approvalOpinion;
	}

	public int getComplaintNum() {
		return complaintNum;
	}

	public void setComplaintNum(int complaintNum) {
		this.complaintNum = complaintNum;
	}

}
